<!DOCTYPE html>
<!-- saved from url=(0047)../goods_detail.html -->
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>goods_detail</title>
  <link rel="stylesheet" href="../styles/taobao.css">
  <link rel="stylesheet" href="../styles/goods_details.css">
  <link rel="Shortcut Icon" href="/front/favicon.ico">
  <link rel="stylesheet" href="/front/plugins/element-ui/index.css">
</head>

<body>
<!--总容器-->
<div class="biggest" id="goodsID">
  <el-dialog
          title="支付信息"
          :visible.sync="dialogVisible"
          width="30%"
          :before-close="handleClose">
    <div style="margin: 10px;color: red;">请核对您的订单信息</div>
    <span style="margin: 10px;">收货地址：</span>
    <el-select v-model="nowAddress" placeholder="请选择">
      <el-option
              v-for="item in addresses"
              :key="item.label"
              :label="item.value"
              :value="item.value">
      </el-option>
    </el-select>
    <el-button @click="addNewAddress()" size="small" round>添加新地址</el-button>
    <div style="margin: 10px;">订单信息</div>
    <div style="margin: 10px;" v-for="item in order">
      <div style="display: flex;flex-direction: row;width:100%;border-radius: 10px;background-color: rgb(247,249,250)">
        <div style="height: 100px;width: 100px;display: flex;
        align-items: center;
        justify-content: center;margin-left: 5px;margin-top: 5px;border:2px solid #f6f6f6;">
          <img :src="baseurl+item.image"
               style="height: 95px;width: 95px;border: black 3px;border-radius: 10px;margin-right: 5px">
        </div>
        <div style="height: 100px;width: 350px;margin-top: 5px;border:2px solid #f6f6f6;">
          <div style="height: 30px;">
            <span>收货人：{{item.goodsName}}</span>
          </div>
          <div style="height: 70px;">{{item.details}}</div>
        </div>
        <div style="height: 100px; width: 50px;display: flex;
        align-items: center;
        justify-content: center;border:2px solid #f6f6f6;">
          <span>{{item.amount}}件</span>
        </div>
        <div style="height: 100px;width: 50px;display: flex;
        align-items: center;
        justify-content: center;border:2px solid #f6f6f6;">
          <span>{{item.price}}</span>
        </div>
      </div>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose()">取 消</el-button>
      <el-button type="primary" @click="buy()">立即支付</el-button>
    </span>
  </el-dialog>
  <div class="middle-left"></div>
  <div class="middle-right">
    <div></div>
  </div>
  <div class="middle-center">
    <!--        顶上的购物服务栏-->
    <div class="top">
      <div class="top-box">
        <div class="top-wrap clearfix">
          <!-- 左边的标志-->
          <div class="top-box-left">
            <a href="/front/index.html" role="img" class="logo-bd clearfix">
              <div class="logo">
                <h1 href="/front/index.html">
                </h1>
              </div>
            </a>
          </div>
          <!-- 中间的搜索框-->
          <div class="top-box-center">
            <div class="search-wrap">
              <div class="search-bd search-suggest search-suggest-group" id="J_Search">
                <div data-sg-type="tab">
                  <ul class="search-suggest-tabs">
                    <li class="search-suggest-tabs-tab selected" data-value="item" name="宝贝">
                      宝贝
                      <div class="search-tab-icon">
                        <i>
                          <em></em>
                          <span></span>
                        </i>
                      </div>
                    </li>
                    <li class="search-suggest-tabs-tab selected" data-value="tmall" name="购物">
                      购物
                    </li>
                    <li class="search-suggest-tabs-tab selected" data-value="shop" name="店铺">
                      店铺
                    </li>
                  </ul>
                </div>

                <!--分隔符-->
                <i class="search-split"></i>
                <!--搜索按钮-->
                <div class="search-button" @click="searchNow()">
                  <button class="btn-search gw-bg">搜索</button>
                </div>
                <div data-sg-type="combobox" class="search-suggest-combobox">
                  <el-input v-model="searchKeyword" placeholder="请输入内容" id="q" name="q" autofocus="true"
                            type="text" accesskey="s" style="border: none;">
                  </el-input>
                </div>

              </div>
              <!-- 搜索框下边的分类-->
              <div class="search-ft J_SearchFt clearfix">
                <div class="J_gwSearchContent J_HotWord">
                  <div class="search-hots">
                    <div class="search-hots-lines">
                      <div class="search-hots-fline" data-spm-ab="fline">
                        <a href="/front/index.html">新款连衣裙</a>
                        <a href="/front/index.html">四件套</a>
                        <a href="/front/index.html">潮流T恤</a>
                        <a href="/front/index.html">时尚男鞋</a>
                        <a href="/front/index.html">短裤</a>
                        <a href="/front/index.html">半身裙</a>
                        <a href="/front/index.html">男士外套</a>
                        <a href="/front/index.html">墙纸</a>
                        <a href="/front/index.html">行车记录仪</a>
                        <a href="/front/index.html">新款男鞋</a>
                      </div>
                      <div class="search-hots-sline" data-spm-ab="sline"></div>
                    </div>
                  </div>
                </div>
                <div class="J_TmallSearchContent J_HotWord J-TmallHotWord tmall-hot-word"
                     data-spm-ab="tmallHotWord"></div>
              </div>
            </div>
          </div>
          <!--二维码-->
          <div class="top-box-right">
            <div class="gwh-qr J_Module" data-name="qr" data-spm="201858" data-bucket="A">
              <div class="qr">
                <a href="/front/index.html" class="qr-bd" clearfix>
                  <span id="mgw" class="h">下载购物</span>
                  <img class="qrcode" src="/front/images/code.png" aria-labelledby="mgw">
                </a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="screen-outer"
         style=" background-color: #fff;/* border-radius: 20px; */padding-left: 10px;padding-top: 20px;">
      <!--左侧放图片的div↓-->
      <div style="float:left;margin-left: 80px; /*background-color: rgb(124, 165, 42); */width: 440px; ">
        <div>
          <div>
            <h3 class="gw-recommend-header">
              <span class="rh-title">精品商品</span>
              <img src="../images/xihuan.png" class="rh-logo">
            </h3>

            <div style="position: relative;">

              <!--  <img class="main_img" src="../images/goods/10047.jpg"
                    style="padding-top: 0px;width: 440px;height: 440px;">-->
              <img :src="baseurl+goodsDetails.image" class="main_img"
                   style="padding-top: 0px;width: 440px;height: 440px;">
            </div>
          </div>
        </div>
      </div>
      <!--右侧详细信息的总div↓-->
      <div style="float:left;width: 527px;margin-left: 70px;margin-top: 50px">
        <div style="background-color: #dededd;height: 90px;width: 500px;border: 1px solid #DEDF3B;float: right;border-radius: 10px;margin-bottom: 10px;line-height: 13px;text-align: left;float: left;font-weight: 800; ">
          <div>
            <a style="font-size: 24px;font-width: 10px; ;float: left;margin-left: 20px; margin-top: 7px; line-height: 33px;width: 500px">{{goodsDetails.name}}
            </a></div>
          <br>
          <div>
            <a style="font-size: 14px;font-weight: 15; ;float: left;margin-left: 20px; margin-top: 7px; line-height: 14px;">{{goodsDetails.description}}
            </a></div>

        </div>
        <!--商品名称div↓-->
        <!--其余分类,购买按钮的div↓-->

        <div style="margin-top: -6px;/* background-color: aquamarine; */float: left;border-radius: 10px;padding-top: 50px;">


          <div style="margin-bottom: 10px;margin-top: 10px;">
              <span class="gray_label" style="
                margin-bottom: 18px;">
             价格：</span>
            <div class="selecgwox">
              <!-- <div class="selectItem "><span class="itemName selectingItem">价格:{{goodsDetails.price}}</span>
              </div>
              <div class="selectItem "><span class="itemName selectingItem">库存:{{goodsDetails.amount}}</span>
              </div>
         <div class="selectItem"><span class="itemName">特酿五号（媲美M台）</span></div>
               <div class="selectItem"><span class="itemName">特酿茅香（领导醉爱）</span></div>
               <div class="selectItem"><span class="itemName">礼盒定制（个性定制）</span></div>-->
              <div style="color: rgb(255, 79, 0);margin-left: 60px"><span style="font-size: 38px;">¥</span><span style="    font-size: 38px;
    line-height: 28px;
    vertical-align: baseline;
    font-family: AlibabaSans102-Bold;">
                    {{goodsDetails.price}}
                </span><!---->
              </div>
            </div>
          </div>
          <div class="font_size-14" style="
    margin-top: 30px;
">
            <div class="gray_label" style="
    line-height: 27px;
">库存：
            </div>
            <div class="Delivery_time" style="
    line-height: 40px;
"><!--
              <div>安徽黄山 至 保定市 莲池区
              </div>
              <div>快递: 免运费</div>
              <div>16:00前付款，预计03月17日送达</div>-->
              <div class="" style="color: darkcyan;"><span></span><span style="    font-size: 18px;
    line-height: 28px;
    vertical-align: baseline;
    font-family: AlibabaSans102-Bold;">
                    {{goodsDetails.amount}}
                </span><!---->
              </div>
            </div>
          </div>

          <div style="margin-top: 9px;">
            <div style="
    padding-top: 30px;
"><span class="gray_label">
                                    数量：</span>
              <div class="plus_minus">
                <!--减号按钮↓ -->
                <div class="plusBtn minusBtn " @click='amountMinus()'><span
                        style="font-size: 24px;line-height: 20px;">-</span>
                </div>
                <!--显示当前选中数量的div↓ -->
                <div class="numberNow">

                  <div class="numberinput" height="0" style=" value: 1;">
                    {{selectAmount}}
                  </div>
                </div>

                <!--加号按钮↓ -->
                <div @click='amountAdd()' class="plusBtn addBtn" style="
    background: linear-gradient(90deg, rgb(255, 119, 0), rgb(255, 73, 0));
">
                  <span style="font-size: 24px;line-height: 24px;">+</span>

                </div>
              </div>
              <div class="gray_label"></div>
            </div>
          </div>
          <div style="position: relative;margin-top: 40px;margin-left: 50px;float: left;">
            <div style="display: inline-block">
              <button class="Actions--btn--3islUgw Actions--lefgwtn--3kx8kg8  Actions--primaryBtn--1UPmwd4"
                      style="background: linear-gradient(90deg, rgb(255, 119, 0), rgb(255, 73, 0)); box-shadow: rgba(255, 119, 0, 0.2) 0px 9px 13px 0px; vertical-align: top;"
                      @click="buyNow()">
                                <span class=""
                                      style="display: inline; font-size: 16px; font-weight: bold; color: rgb(255, 255, 255);"
                                >立即购买</span>
              </button>
              <button @click='shoppingCart()'
                      class="Actions--btn--3islUgw  Actions--righgwtn--3Ma6IDT  Actions--primaryBtn--1UPmwd4"
                      style="background: linear-gradient(90deg, rgb(255, 203, 0), rgb(255, 148, 2)); box-shadow: rgba(255, 203, 0, 0.2) 0px 9px 13px 0px; vertical-align: top;">
                                <span class=""
                                      style="display: inline; font-size: 16px; font-weight: bold; color: rgb(255, 255, 255);">加入购物车</span>
              </button>
            </div>
            <div class="Actions--divider--2U8scvj"></div>
            <div style="display: inline-block">
              <button class="Actions--btn--3islUgw Actions--collect--1Hewtdn  Actions--texgwtn--2gV3XJs"
                      style="vertical-align: top;">

                                    <span class="Actions--iconText--2UTH-0g"
                                          style="display: inline; font-size: 14px; font-weight: normal; color: rgb(102, 102, 102);">
                                    </span>
              </button>
            </div>
          </div>


        </div>
      </div>
    </div>
    <div class="details">
      <div>
        <div>

          <div>
            <!--  <img src="../images/JianNanChun001.jpg" class="img-middle">-->
            <img :src="baseurl+goodsDetails.image" class="img-middle">

          </div>

          <div>
            <!-- <img src="../images/JianNanChun003.jpg" class="img-middle">-->
            <img :src="baseurl+goodsDetails.image" class="img-middle">

          </div>
          <div>
            <!--<img src="../images/JianNanChun004.jpg" class="img-middle">-->
            <img :src="baseurl+goodsDetails.image" class="img-middle">

          </div>


        </div>
      </div>
    </div>
    <div class="help">
      <div class="" style="">
        <div class="">
          <div class="helper ">
            <div class="mod">
              <div class="mod-wrap">
                <h4>
                  <i class="gw-ifont"></i>
                  <span>
                                            规则与协议
                                        </span>
                </h4>
                <ul>
                  <li><a href="">购物规则</a></li>
                  <li><a href="">退货退款流程</a></li>
                  <li><a href="">服务中心</a></li>
                  <li><a href="">更多特色服务</a></li>
                  <li><a href="">平台服务协议</a></li>
                  <li><a href="">规则意见征集</a></li>
                </ul>
              </div>
            </div>
            <div class="mod">
              <div class="mod-wrap">
                <h4>
                  <i class="gw-ifont"></i>
                  <span>新手上路</span>
                </h4>
                <ul>
                  <li><a href="">24小时在线帮助</a></li>
                  <li><a href="">免费开店</a></li>
                </ul>
              </div>
            </div>
            <div class="mod">
              <div class="mod-wrap">
                <h4>
                  <i class="gw-ifont"></i>
                  <span>付款方式</span>
                </h4>
                <ul>
                  <li><a href="">快捷支付</a></li>
                  <li><a href="">信用卡</a></li>
                  <li><a href="">余额宝</a></li>
                  <li><a href="">蚂蚁花呗</a></li>
                </ul>
              </div>
            </div>
            <div class="mod mod-last">
              <div class="mod-wrap">
                <h4>
                  <i class="gw-ifont"></i>
                  <span>购物特色</span>
                </h4>
                <ul>
                  <li><a href="">手机购物</a></li>
                  <li><a href="">旺旺/旺信</a></li>
                  <li><a href="">大众评审</a></li>
                </ul>
              </div>
            </div>

          </div>
        </div>
      </div>
    </div>
    <div class="">
      <div class="J_SiteFooter" style="min-height: 150px">
        <div class="gw-footer gw-footer-with-logo">
          <div class="gw-footer-hd">
            <p>
                                <span>
                                    <a>阿里巴巴集团</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>购物网</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>购物</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>聚划算</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>全球速卖通</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>阿里巴巴国际交易市场</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>1688</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>阿里妈妈</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>飞猪</a></span>
              <b>|</b>
              <span>
                                    <a>阿里云计算</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>AliOS</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>阿里通信</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>一淘</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>万网</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>高德</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>UC</a>
                                </span>
              <b>|</b>
              <span>
                                <a>友盟</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>阿里安全</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>大麦网</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>钉钉</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>支付宝</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>优酷</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>土豆</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>阿里健康</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>阿里影业</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>网商银行</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>造点新货（众筹）</a>
                                </span>
              <b>|</b>
            </p></div>
          <div class="gw-footer-bd">
            <p>
                                <span>
                                    <a>关于购物</a>
                                </span>
              <span>
                                    <a>营销中心</a>
                                </span>
              <span>
                                    <a>廉正举报</a>
                                </span>
              <span>
                                    <a>联系客服</a>
                                </span>
              <span>
                                    <a>开放平台</a>
                                </span>
              <span>
                                    <a>诚征英才</a>
                                </span><span>
                                    <a>联系我们</a>
                                </span>
              <span>
                                    <a>隐私权政策</a>
                                </span>
              <span>
                                    <a>法律声明</a>
                                </span>
              <span>
                                    <a>知识产权</a>
                                </span>
              <span>
                                    <a>不当竞争举报</a>
                                </span>
              <b>|</b>
              <em>© 2003-现在 Taobao.com 版权所有</em>
            </p>
            <p>
              <span>增值电信业务经营许可证：浙B2-20080224</span>
              <b>|</b>
              <span>增值电信业务经营许可证（跨地区）： B2-20150210</span>
              <b>|</b>
              <span>浙网文【2022】0403-017号</span>
              <b>|</b>
              <span>浙江省网络食品销售第三方平台提供者备案：浙网食A33010001</span>
              <b>|</b>
              <br>
            </p>
            <p>
              <span>互联网药品信息服务资格证书（浙）-经营性-2018-0010</span>
              <b>|</b>
              <span>短消息类服务接入代码使用证书：号【2016】00154-A01</span>
              <b>|</b>
              <span>信息网络传播视听许可证：1109364号</span>
              <b>|</b>
              <span>出版物网络交易平台服务经营备案号：新出发浙备字第002号</span>
              <b>|</b>
            </p>
            <p>
                                <span>
                                    <a>
                                        <span class="gw-footer-mod"
                                              style="background-position: -861px 0px; width: 20px; height: 20px;">
                                        </span>浙公网安备 33010002000078号
                                    </a>
                                </span>
              <b>|</b>
              <span>
                                    <a>浙B2-20080224-1</a>
                                </span>
              <b>|</b>
              <span>广播电视节目制作经营许可证（浙）字第01012号</span>
              <b>|</b>
              <span>市场名称登记证：工商网市字3301004120号</span>
              <b>|</b>
              <span>医疗器械网络交易服务第三方平台备案：（浙）网械平台备字[2018]第00004号</span>
              <b>|</b>
              <span>
                                    <a>互联网违法和不良信息举报电话：0571-81683755 jubao.gw@service.taobao.com</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>中国扫黄打非网</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>全国文化和旅游市场网上举报投诉处理系统</a>
                                </span>
              <b>|</b>
              <span>
                                    <a>全国12315平台</a>
                                </span>
              <b>|</b>
              <span><a>浙江省互联网违法和不良信息举报中心</a></span>
              <b>|</b>
              <span>
                                    <a>全网举报</a>
                                </span>
              <b>|</b><br>
            </p>
          </div>
          <div class="gw-footer-ft">
            <a href=""
               class="gw-footer-mod" style="width: 30px;background-position: 0 0;"></a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="../plugins/vue/vue.js"></script>
<!-- 引入组件库 -->
<script src="../plugins/element-ui/index.js"></script>
<!-- 引入axios -->
<script src="../plugins/axios/axios.min.js"></script>
<script src="../js/request.js"></script>
<script src="../js/common.js"></script>
<script src="../api/goods.js"></script>
<script src="../api/cart.js"></script>
<!-- 引入组件库 -->
<!-- 引入axios -->
<script src="../js/validate.js"></script>
<script src="../js/alert.js"></script>
<script src="/backend/api/user.js"></script>
<script src="/front/api/order.js"></script>
<script>

    new Vue({
        el: '#goodsID',
        metaInfo: {
            title: ''
        },
        data() {
            return {
                id: '',
                goodsDetails: '',
                selectAmount: 0,
                userInfo: '',
                userId: '',
                baseurl: 'http://localhost:8080/front/images/goods/',
                nowPayStatus: 0,
                dialogVisible: false,
                addresses: [],
                nowAddress: '',
                key: 1,
                searchKeyword: '',
                order: []
            }
        },
        mounted: function () {
            this.init()
        },
        methods: {
            async init() {
                let str = location.href;
                //查找关键字
                this.userInfo = window.localStorage.getItem('userInfo')
                let l = str.indexOf('=');
                let r = str.length;
                //取两者之间的字符串截取
                this.id = str.substr(l + 1, r - l - 1);
                await queryGoodsById(this.id).then(res => {
                    if (String(res.code) === '1') {
                        this.goodsDetails = res.data
                        window.document.title = this.goodsDetails.name
                    }
                }).catch(err => {
                    this.$message.error('请求出错了：' + err)
                })
                this.userId = JSON.parse(this.userInfo).id;
            },

            amountAdd() {
                if (this.selectAmount <= this.goodsDetails.amount - 1)
                    this.selectAmount++;
                else
                    this.$message.info("已到库存上限啦！")
            },
            amountMinus() {
                if (this.selectAmount !== 0) {
                    this.selectAmount--;
                }
            },
            async shoppingCart() {
                let nowPhone = JSON.parse(this.userInfo).phone;
                if (nowPhone == null) {
                    this.$alert('用户尚未绑定手机号，请前往个人界面填写手机号！', '手机号绑定提示', {
                        confirmButtonText: '确定',
                        callback: () => {
                            window.location.href = '/front/page/personal.html';
                        }
                    });
                    return;
                }
                if (this.selectAmount === 0) {
                    if (this.goodsDetails.amount === 0) {
                        this.$message.error('请选择购买数量！')
                    } else {
                        this.$message.error('请选择购买数量！')
                    }
                    return
                }
                let data = {
                    goodsId: this.goodsDetails.id,
                    userId: JSON.parse(this.userInfo).id,
                    name: this.goodsDetails.name,
                    price: this.goodsDetails.price,
                    image: this.goodsDetails.image,
                    amount: this.selectAmount
                }
                await addGoodsToShoppingCart(data).then(res => {
                    if (String(res.code) === '1') {
                        this.goodsDetails = res.data
                        window.document.title = this.goodsDetails.name
                        this.$alert('添加购物车成功！', '添加购物车提示', {
                            confirmButtonText: '确定',
                        });
                        this.init()
                    }
                }).catch(err => {
                    this.$message.error('请求出错了：' + err)
                })
                this.init()
            },
            async handleQueryAddress() {
                await queryAddressByUserId(this.userId).then(res => {
                    if (String(res.code) === '1') {
                        const addressArray = res.data;
                        this.addresses = addressArray.map(address => {
                            const [label, value] = [this.key, address];
                            this.key++;
                            return {label, value};
                        });
                    }
                }).catch(err => {
                    this.$message.error('请求出错了：' + err)
                })

            },
            async buyNow() {
                if (this.selectAmount === 0) {
                    this.$message.error('请选择购买数量！')
                    return
                }
                if (this.userInfo == null) {
                    this.$message.error('请先登录！')
                    return
                }
                let nowPhone = JSON.parse(this.userInfo).phone;
                if (nowPhone == null) {
                    this.$alert('用户尚未绑定手机号，请前往个人界面填写手机号！', '手机号绑定提示', {
                        confirmButtonText: '确定',
                        callback: () => {
                            window.location.href = '/front/page/personal.html';
                        }
                    });
                    return;
                }

                this.dialogVisible = true
                await this.handleQueryAddress()
                let newOrder = {
                    address: this.nowAddress,
                    image: this.goodsDetails.image,
                    goodsName: this.goodsDetails.name,
                    details: this.goodsDetails.description,
                    amount: this.selectAmount,
                    price: this.goodsDetails.price
                }
                this.order.push(newOrder)
            },
            handleClose(done) {
                this.order = []
                this.dialogVisible = false
            },
            async buy() {

                this.order = []
                this.dialogVisible = false
                const params = {
                    status: 2,
                    goodsId: this.goodsDetails.id,
                    userId: this.userId,
                    phone: JSON.parse(this.userInfo).phone,
                    address: this.nowAddress,
                    consignee: JSON.parse(this.userInfo).username,
                    goodsName: this.goodsDetails.name,
                    image: this.goodsDetails.image,
                    amount: this.selectAmount,
                    price: this.goodsDetails.price,
                    goodsDetail: this.goodsDetails.description
                }
                await buyNewOne(params).then(res => {
                    if (String(res.code) === '1') {
                        queryGoodsById(this.id).then(res => {
                            if (String(res.code) === '1') {
                                this.goodsDetails = res.data
                            }
                        }).catch(err => {
                            this.$message.error('请求出错了：' + err)
                        })
                        this.$alert('购买成功！', '购买提示', {
                            confirmButtonText: '确定',
                        });
                    } else {
                        console.log(res.msg)
                        this.$message.error(res.msg)
                    }
                }).catch(err => {
                    this.$message.error('购买失败了！' + err)
                })

            },
            async searchNow() {
                window.location.href = '/front/page/search.html' + '?q=' + this.searchKeyword
            },
            addNewAddress() {
                window.location.href = '/front/page/personal.html'
            }
        }
    })


</script>


</body>
</html>